import Abstract from '../abstract';

class BannerAPI extends Abstract {
    bannerList() {
        return this.getReq({url: 'Banner.banner'});
    }

    addBanner(data: { name: string; sort?: any }) {
        return this.postReq({url: 'Banner.banner_add', data});
    }

    editBanner(data: any) {
        return this.postReq({url: 'Banner.banner_edit', data});
    }

    deleteBanner(data: { id: string }) {
        return this.getReq({url: 'Banner.banner_delete', params: data});
    }
}

// 单列模式返回对象
let instance;
export default (() => {
    if (instance) return instance;
    instance = new BannerAPI();
    return instance;
})();
